using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Dynamic;
using YTS.Tools;

namespace Test.ConsoleProgram.Algorithm.Solution
{
    [TestDescription("算法: 0136. 只出现一次的数字")]
    public class No0136_SingleNumber : AbsBaseTestItem
    {
        public override void OnTest()
        {
            Assert.TestExe(SingleNumber, new int[] { 2, 2, 1 }, 1);
            Assert.TestExe(SingleNumber, new int[] { 4, 1, 2, 1, 2 }, 4);

            Assert.TestExe(SingleNumber, new int[] { 2, 2, 1 }, 1);
        }

        public int SingleNumber(int[] nums)
        {
            int value = 0;
            foreach (int item in nums)
            {
                value ^= item;
            }
            return value;
        }
    }
}
